package com.leyou.item.web;

import com.leyou.item.pojo.Category;
import com.leyou.item.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @program: leyou
 * @description: 商品类目控制层
 * @author: NieMiao
 * @create: 2018-11-05 16:59
 **/
@RestController
@RequestMapping("category")
public class CategoryController {
    @Autowired
    private CategoryService categoryService;
    @GetMapping("list")
    public ResponseEntity<List<Category>> queryListByPid(@RequestParam("pid")Long pid) {
        List<Category> categoryList = categoryService.queryListByPid(pid);
        return ResponseEntity.ok(categoryList);
    }
}
